package com.caipiao.lottery.core;

import com.caipiao.lottery.log.TraceLogger;

public class CoreStart {
    public static void main(String[] args) throws InterruptedException {

        System.out.println("准备停止");
        try {
            String start_cfg_file = "";

            //参数启动解析
            if (args.length <= 0) {
                start_cfg_file = "config/start.prop";
            } else        //1个参数
            {
                start_cfg_file = args[0];
            }

            if (!SYSInterface.Instance().Init(start_cfg_file)) {
                TraceLogger.System.error("系统启动失败,检查启动配置文件," + start_cfg_file);
                System.exit(0);
            }

            if (!SYSInterface.Instance().Start()) {
                TraceLogger.System.error("系统启动失败,退出后检查系统日志!");
                System.exit(0);
            }
        } catch (Exception e) {
            String excep_Str = "系统运行异常:" + e + "|" + e.getStackTrace();
            TraceLogger.System.error(excep_Str);

            String sys_str = "系统异常时状态:" + SysState.GetSysStatusInfo();
            TraceLogger.System.error(sys_str);
        }
    }
}
